<?php
/**
 * 淘宝商品数据抓取
 *
 * Author: Zeon
 * Date: 2018/5/8
 * Time: 14:47
 * Created by PanxSoft.
 */
namespace App\Http\Controllers\Admin;


use App\Http\Controllers\ApiController;
use App\Http\Requests\TaoBaoCrawlerRequest;
use App\Services\TaoBao\ItemDetailService;

class TaobaoItemDetailGetController extends ApiController
{

    protected $itemDetailService;

    public function __construct(ItemDetailService $itemDetailService)
    {
        $this->itemDetailService = $itemDetailService;
    }


    /**
     * @param TaoBaoCrawlerRequest $request
     * @return array|\Illuminate\Http\Response
     * @throws \App\Exceptions\ApiException
     */
    public function crawlerFromUrl(TaoBaoCrawlerRequest $request)
    {

        $url = $request->url;

        $result = $this->itemDetailService->crawlerGetItemDetailUseNode($url);

        return $this->response(compact('result'));

    }
}